﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.Win32;


namespace Piao
{
    public partial class WebForm : Form
    {
        public WebForm()
        {
            InitializeComponent();
            IESetting = 0;
            this.Icon = Icon.ExtractAssociatedIcon(Environment.ExpandEnvironmentVariables("%windir%" + @"\system32\winver.exe"));
        }



        /// <summary>
        ///注意：除非另外声明，否则每个 DWORD 值等于 0、1 或 3。
        ///通常，设置为 0 则将具体操作设置为允许；设置为 1 则导致出现提示；设置为 3 则禁止执行具体操作。
        /// </summary>
        private int IESetting
        {
            // http://support.microsoft.com/kb/182569/zh-cn

            get
            {
                RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3", true);
                string val = key.GetValue("1609", "3").ToString();
                return int.Parse(val);
            }
            set
            {
                RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3", true);
                key.SetValue("1609", value, RegistryValueKind.DWord);
            }
        }


        private void menu_Navigate_Click(object sender, EventArgs e)
        {
            if (webBrowser1.Document == null)
                webBrowser1.Navigate("about:blank");

            webBrowser1.Navigate(UserOpration.URL_HOME);

        }

        private void webBrowser1_BeforeNewWindow(object sender, WebBrowserExtendedNavigatingEventArgs e)
        {
            e.Cancel = true;
            ((ExtendedWebBrowser)sender).Navigate(e.Url);

        }

        

    }
}
